#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct stu {
	char name[20];
	int age;
};

int sort_age(const void* e1, const void* e2) {
	return ((struct stu*)e1)->age - ((struct stu*)e2)->age;
}

int sort_name(const void* e1, const void* e2) {
	return strcmp(((struct stu*)e1)->name, ((struct stu*)e2)->name);
}

int main() {
	struct stu omm[3] = { {"zhangsan",72},{"lisi",19},{"wangwu",69} };
	int sz = sizeof(omm) / sizeof(omm[0]);
	qsort(omm, sz, sizeof(omm[0]), sort_age);
	//qsort(omm, sz, sizeof(omm[0]), sort_name);
	return 0;
}